import 'package:flutter/material.dart';

class BmWidget extends StatefulWidget {
  final state;

  const BmWidget({Key key, this.state}) : super(key: key);

  @override
  State<BmWidget> createState() => _BmWidgetState();
}

class _BmWidgetState extends State<BmWidget> {
  List bmList = [
    {
      'unActiveIcon': 'images/active/bm1.png',
      'activeIcon': 'images/active/bm1-1.png',
      'isActive': true,
      'name': '报名开始',
      'create_time': '2020-11-08'
    },
    {
      'unActiveIcon': 'images/active/bm2.png',
      'activeIcon': 'images/active/bm2-1.png',
      'isActive': false,
      'name': '报名截止',
      'create_time': '2020-11-18'
    },
    {
      'unActiveIcon': 'images/active/bm1.png',
      'activeIcon': 'images/active/bm1-1.png',
      'isActive': false,
      'name': '比赛日期',
      'create_time': '2020-11-28'
    },
  ];

  Color selectColor = Colors.black;
  Color unselectColor = Color.fromRGBO(153, 153, 153, 1);

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        Container(
          padding: EdgeInsets.symmetric(horizontal: 40,vertical: 15),
          child: Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Container(
                child: Column(
                  children: [
                    Container(
                      child: widget.state == 0
                          ? Image.asset(
                              'images/active/bm1-1.png',
                              width: 37,
                              height: 37,
                            )
                          : Image.asset(
                              'images/active/bm1.png',
                              width: 37,
                              height: 37,
                            ),
                    ),
                    Container(
                      margin: EdgeInsets.only(top: 10),
                      child: Text(
                        '报名开始',
                        style: TextStyle(
                            fontSize: 12,
                            color: widget.state == 0
                                ? selectColor
                                : unselectColor),
                      ),
                    ),
                    Container(
                      child: Text(
                        '2020-5-9',
                        style: TextStyle(
                            fontSize: 10,
                            color: widget.state == 0
                                ? Color.fromRGBO(102, 102, 102, 1)
                                : unselectColor),
                      ),
                    )
                  ],
                ),
              ),
              Container(
                margin: EdgeInsets.only(top: 5),
                child: Icon(
                  Icons.double_arrow_rounded,
                  color: Color.fromRGBO(204, 204, 204, 1),
                ),
              ),
              Container(
                child: Column(
                  children: [
                    Container(
                      child: widget.state == 1
                          ? Image.asset(
                        'images/active/bm2-1.png',
                        width: 37,
                        height: 37,
                      )
                          : Image.asset(
                        'images/active/bm2.png',
                        width: 37,
                        height: 37,
                      ),
                    ),
                    Container(
                      margin: EdgeInsets.only(top: 10),
                      child: Text(
                        '报名截止',
                        style: TextStyle(
                            fontSize: 12,
                            color: widget.state == 1
                                ? selectColor
                                : unselectColor),
                      ),
                    ),
                    Container(
                      child: Text(
                        '2020-5-19',
                        style: TextStyle(
                            fontSize: 10,
                            color: widget.state == 1
                                ? Color.fromRGBO(102, 102, 102, 1)
                                : unselectColor),
                      ),
                    )
                  ],
                ),
              ),
              Container(
                margin: EdgeInsets.only(top: 5),
                child: Icon(
                  Icons.double_arrow_rounded,
                  color: Color.fromRGBO(204, 204, 204, 1),
                ),
              ),
              Container(
                child: Column(
                  children: [
                    Container(
                      child: widget.state == 2
                          ? Image.asset(
                        'images/active/bm3-1.png',
                        width: 37,
                        height: 37,
                      )
                          : Image.asset(
                        'images/active/bm3.png',
                        width: 37,
                        height: 37,
                      ),
                    ),
                    Container(
                      margin: EdgeInsets.only(top: 10),
                      child: Text(
                        '比赛开始',
                        style: TextStyle(
                            fontSize: 12,
                            color: widget.state == 2
                                ? selectColor
                                : unselectColor),
                      ),
                    ),
                    Container(
                      child: Text(
                        '2020-5-9',
                        style: TextStyle(
                            fontSize: 10,
                            color: widget.state == 2
                                ? Color.fromRGBO(102, 102, 102, 1)
                                : unselectColor),
                      ),
                    )
                  ],
                ),
              ),

            ],
          ),
        ),
        Container(
          height: 8,
          color: Color.fromRGBO(249, 249, 249, 1),
        ),
      ],
    );
  }
}
